ggplot2ggplot2 package uses the grammar of graphicstidyverseWe will need the following two packages for the examples in these slides.
ggplot()+geom functions
geom_point() adds pointsaes()ggplot(data = penguins))aes()aes()aes()
geom_point(aes(colour = species))aes()aes() are common when learning ggplot2aes()aes()ggplot(data = penguins,
aes(x = body_mass_g, y = bill_length_mm, colour = species)) +
geom_point() +
geom_smooth(method = "lm") +
facet_grid(island~species) +
labs(x = "Body mass (g)", y = "Bill length (mm)", colour = "Species") + # Change labels
theme(legend.position = "bottom") # Change legend position